Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sol!): rm fake transport from contract expansion #865

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yash-atreya
Copy link
Member

@yash-atreya yash-atreya commented Feb 3, 2025

Motivation

After alloy-rs/alloy#1859, we have been using fake traits to avoid breaking sol! codegen.
See: https://github.com/alloy-rs/alloy/blob/370dbef8d900ab0e935270b6cc516cdad3c16b7a/crates/contract/src/lib.rs#L43

    // alloy_contract/lib.rs
    // Fake traits to mitigate `sol!` macro breaking changes.
    pub trait Provider<T, N: Network>: alloy_provider::Provider<N> {}
    impl<N: Network, P: alloy_provider::Provider<N>> Provider<(), N> for P {}

    // This is done so that the compiler can infer the `T` type to be `()`, which is the only type
    // that implements this fake `Transport` trait.
    pub trait Transport {}
    impl Transport for () {}

Solution

This PR makes the necessary changes to the sol! contract expansion to avoid using these fake traits.

Companion PR in alloy: alloy-rs/alloy#1996

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@yash-atreya yash-atreya changed the title fix: rm fake transport from contract expansion fix(sol!): rm fake transport from contract expansion Feb 3, 2025
@yash-atreya yash-atreya self-assigned this Feb 3, 2025
@yash-atreya yash-atreya added the enhancement New feature or request label Feb 3, 2025
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, but we should probably only merge this once more people are on alloy 0.11 @DaniPopes ?

@DaniPopes
Copy link
Member

DaniPopes commented Feb 3, 2025

This will require another breaking alloy release as well, due to breaking bump of core

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking enhancement New feature or request
Projects
Status: Ready for Review
Development

Successfully merging this pull request may close these issues.

3 participants